<?php
$defaultCss = array( 'admin','admin_custom','admin-tables','admin-forms','admin-typography','admin-grids','boxy' );
$defaultJs = array('jquery.admin','admin','site','jquery.boxy');
$pageCss = isset($pageCss) ? array_merge($defaultCss,$pageCss) : $defaultCss; 	//设置css风格文件
$pageJs = isset($pageJs) ? array_merge($defaultJs,$pageJs) : $defaultJs;;	//设置Js文件
global $class,$method;
$__user = isset($_user) ? $_user : array('username'=>'');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理<?=isset($pageTitle)?'-'.$pageTitle:''?></title>
<?php foreach( $pageCss  as $file):?>
<link href="<?=base_url("css/admin/{$file}.css")?>" media="screen" rel="stylesheet" type="text/css" />
<?php endforeach;?>
<?php foreach( $pageJs  as $file):?>
<script type='text/javascript' src="<?=base_url("js/{$file}.js")?>"></script>
<?php endforeach;?>
</head>
<body>
	<div class=admin_box>
		<div id="header">
		  <ul id="login-nav">
		    <li>欢迎回来:  <?=$__user['username'];?> 
		    	<div id="progress"><img alt="Progress" src="<?=base_url('images/progress.gif')?>"> Loading...</div>
		    </li>
		    
		    <li><a href="<?=site_url('admin/users/logout')?>?redirect=<?=rawurlencode(site_url('admin/home/login'))?>">退出</a></li>
		    <li><a href="<?=site_url()?>" target="_blank">网站</a></li>
		  </ul>
		  <a href="/admin"><img alt="eushop" id="logo" src="<?=base_url('images/admin/logo.png')?>"></a>
		  <h1><a href="/admin">Administrator</a></h1>
		  <div id="progress"><img alt="Progress" src="<?=base_url('images/progress.gif')?>"> Loading...</div>
		</div>
		<div id="admin-menu">
		  <ul>
		  	<?php 
		  		foreach($modules as $k=>$m):
		  		if($m['parent_id'] == 0 && $m['status'] && $m['is_admin']):
		  	?>
		    <li<?php if( $m['mod_code']==$class): ?> class="selected"<?php endif;?>>
		    <a href="<?=site_url('admin/'.$m['mod_url'])?>"><?=$m['mod_name']?></a>
		    </li>
		    <?php endif; endforeach;?>
		  </ul>
		  <br class="clear" />
		</div>
		<div id="sub-menu">
		  <ul id="sub_nav">
		  	<?php 
		  		if(isset($currModule['sub'])):	
		  		foreach($currModule['sub'] as $k=>$cm):
		  	?>
		    <li<?php if(strpos($cm['mod_code'],$method)!==false): ?> class="selected"<?php endif;?>>
		    	<a href="<?=site_url('admin/'.$cm['mod_url'])?>"><?=$cm['mod_name']?></a>
		    </li>
		    <?php endforeach;endif;?>
		  </ul>
		  <br class="clear" />
		</div>